<?php
/**
 * 
 * @author wb_wenjie.wuwj <wb_wenjie.wuwj@alibaba-inc.com>
 * @copyright 2013-3-25 yahoo
 */

class LoginController extends Controller
{
	public $defaultAction = 'login';
	public $layout='column1';
	
	public function init()
	{
		//var_dump(Yii::app());
		//parent::init();
	}
	public function ActionLogin()
	{
		
		//var_dump(Yii::app()->user->getIsAuthenticated());
		$model = new LoginForm;
		
		if(isset($_POST['LoginForm']))
		{
			$model->attributes=$_POST['LoginForm'];
			// validate user input and redirect to the previous page if valid
			if($model->validate() && $model->login())
			{
				//echo Yii::app()->user->returnUrl;
				//$this->redirect(Yii::app()->user->returnUrl);
			}
		}
		
		$this->render('login', array('model' => $model));
		//$c = $this->renderPartial('login', array('var'=>'yes I am.'), TRUE);
		$conn = Yii::app()->db;
		//$rows = $conn->createCommand('select count(*) as u_sum from {{manager}}')->queryRow();
		//var_dump(get_class_methods($conn));
		//$rows = $conn->queryRow();
		//var_dump(Yii::app()->user);
	}
	
	public function ActionTest()
	{
		echo 'test';
	}
}